/************************************************************************

								Heroes IV
					  Copyright 2001, The 3DO Company

	------------------------------------------------------------------
  						     magic_university.h

	$Header: /game/school_of_magic.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef MAGIC_UNIVERSITY_H_INCLUDED
#define MAGIC_UNIVERSITY_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "bool_array.h"
#include "single_use_object.h"
#include "skill_set.h"

class t_magic_university : public t_stationary_adventure_object
{
public:
    t_magic_university( t_stationary_adventure_object const& source );

    void            activate_trigger( t_army* army, t_adv_map_point const& point, 
		                              t_direction direction, t_adventure_frame* frame );
	virtual float	ai_value( t_adventure_ai const& ai, t_creature_array const& army, int move_cost ) const;	
    void            select_heroes_dialog( std::vector<t_hero*> const& heroes, t_window* parent, t_army* army);
    int             get_version() const;
	virtual void	place( t_adventure_map &		map,
						   t_adv_map_point const&	point );
    virtual bool    read( std::streambuf&						stream, 
						  t_qualified_adv_object_type const&	type,
						  int									version );
	virtual bool	read_from_map( std::streambuf& stream, t_progress_handler* progress);
	virtual void	right_click( t_mouse_event const& event,
	                                 t_adventure_frame* adventure_frame );
    virtual bool    write( std::streambuf& stream ) const;
    
protected:
	t_skill_set		m_available_skills; // Set in read_from_map(), used in place(). Don't use after initialization.
	t_skill_set		m_required_skills;  // Set in read_from_map(), used in place(). Don't use after initialization.
    t_skill_list    m_skills;
	t_bool_array	m_visited;

	virtual t_skill_set const & get_default_available_skill_set();
	t_skill_type	get_best_compatible_skill( t_hero const* hero, t_creature_array const* array ) const;
	float			sum_available_skill_values(t_creature_array const& array) const;

private:
	void			set_available_skills();
};

/*
** War College - similar to Magic University.
*/
class t_war_college : public t_magic_university
{
public:
    t_war_college( t_stationary_adventure_object const& source );

	float ai_value( t_adventure_ai const& ai, t_creature_array const& army, int move_cost ) const;

protected:
	virtual t_skill_set const & get_default_available_skill_set();
};

#endif // MAGIC_UNIVERSITY_H_INCLUDED



